<?php

# http://projects:8081/cdapp-2kt-api/api/global_params.php

include_once './_portal.php';

if (isset($post->params) && is_array($post->params) || count($post->params) > 0) {
  $content = [];
  foreach ($post->params as $param) {
    if (is_string($param)) {
      $content[$param] = param($param);
    } elseif (isset($param->key)) {
      if (isset($param->value)) {
        $content[$param->key] = param($param->key, $param->value);
      } else {
        $content[$param->key] = param($param->key);
      }
    } else {
      //
    }
  }
  output(['code' => 1, 'msg' => 'successed: ' . count($content), 'content' => $content]);
} else {
  output(['code' => -1, 'msg' => 'missing parameter']);
}

die();